<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
	
	<table cellspacing="2" border="0" width="995">
		<tr>
			<td width="995" class="title_manager_product">Quản lý quảng cáo</td>
		</tr>
		<tr>
			<td>
				<table border="0" cellpadding="0" cellspacing="0" width="995">
					<tr>
						<td align="center">
							<table border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td align="center"><a href="index.php?admin=advAdmin&do=formaddfile"><img src="images/CreateNews.gif" width="48" height="47" border="0" /></a></td>
								</tr>
								<tr>
									<td align="center" class="title_new_add"><a href="index.php?admin=advAdmin&do=formaddfile">Tạo quảng cáo</a></td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>	
		</tr>
	</table>
	<table class="reference" cellspacing="0" border="1" width="995">	
    	<tr>
        	<td width="30"><b>Id</b></td>
            <td width="220"><b>Tên quảng cáo</b></td>
            <td width="300"><b>Vị trí</b></td>
			<td width="80"><b>Trạng thái</b></td>
            <td width="156"><b>Chức năng</b></td>
        </tr>
        <?php
        	$query="SELECT * FROM advertisements";
            $result=mysql_query($query) or die(mysql_error());
            while($rows=mysql_fetch_array($result)){?>
            <tr>
            	<td><?php echo $rows['id'];?></td>
                <td><?php echo $rows['nameAdv'];?></td>                         
                <td><?php echo $rows['position'];?></td> 
				<td><?php
					if($rows['state']=='on'){
						echo "Hiện";
					}else{
						echo "Ẩn";
					}
				?></td> 
                
                <td align="center">
                    <a href="index.php?admin=advAdmin&do=formeditfile&id=<?php echo $rows['id'];?>" title="Sửa"><img src="images/edit.gif" width="17" height="17" border="0" /></a>
                    <a href="index.php?admin=advAdmin&do=deletefile&id=<?php echo $rows['id'];?>" onclick="return confirm('Bạn có muốn xoá quảng cáo này không?');" title="Xóa"><img src="images/delete.gif" width="17" height="17" border="0" /></a>                          
                </td> 
            </tr>
        <?php
        }
		?>    
    </table>
</body>
</html>
